// #include <memory>
// using std::unique_ptr;
#include <iostream>
#include "unique_ptr.h"
using std::cout;
using std::endl;

class Task{
public:
    int tid;
    Task(int id = 3): tid(id){
        cout << "con - Task" << endl;
    }
    ~Task(){
        cout << "dec - Task" << endl;
    } 
};

void is_empty(unique_ptr<Task>& ptr){
    if(ptr) cout << "no empty ptr";
    else cout << "empty ptr";
    cout << endl;
}
int main(int argc, char const *argv[])
{
    unique_ptr<Task> uptr1;
    is_empty(uptr1);

    unique_ptr<Task> uptr2(new Task);
    is_empty(uptr2);

    {
        unique_ptr<Task> uptr3(new Task(8));
        cout << uptr3.get() << endl;
    }

    // cout << uptr2->tid << endl;

    cout << uptr1.get() << endl;
    cout << uptr2.get() << endl;

    uptr1 = std::move(uptr2);
    cout << uptr1.get() << endl;
    cout << uptr2.get() << endl;

    // uptr1.reset();
    // cout << uptr1.get() << endl;

    return 0;
}
